{include file="./layout/header.html" /}
<body>
<div class="x-body" >

    <form class="layui-form" id="intr">

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input   type="hidden" id="sid" name="sid" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value='{$sid}'>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input   type="hidden" id="hotel" name="hotelid" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value='{$hotelid}'>
            </div>
        </div>


        {present name="$intr->translations[1]"}
        {foreach $lang.hy as $key => $vo}
        {if condition="$vo.lan eq $intr->translations[$key]->locale"}
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['currency']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.currency}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['currency']" name="translations[{$vo.lan}][currency]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key]->currency}">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['name']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.coatname}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['name']" name="translations[{$vo.lan}][name]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key]->name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['price']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.coatprice}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['price']" name="translations[{$vo.lan}][price]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key]->price}">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="['{$vo.lan}']['description']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.content}
            </label>
            <div class="layui-input-block">
                <textarea style="padding:0px" placeholder="请输入内容" id="['{$vo.lan}']['content']" name="translations[{$vo.lan}][description]" class="layui-textarea">{$intr->translations[$key]->description}</textarea>
            </div>
        </div>
        {if condition="$vo.lan eq 'en'"}
        <!-- 实例化编辑器 -->
        <script type="text/javascript">
            var ue = UE.getEditor("['en']['content']");
        </script>
        {else/}
        <script type="text/javascript">
            var ue = UE.getEditor("['zh-CN']['content']");
        </script>
        {/if}
        {else/}
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['currency']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.currency}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['currency']" name="translations[{$vo.lan}][currency]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key+1]->currency}">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['name']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.coatname}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['name']" name="translations[{$vo.lan}][name]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key+1]->name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['price']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.coatprice}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['price']" name="translations[{$vo.lan}][price]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key+1]->price}">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="['{$vo.lan}']['description']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.content}
            </label>
            <div class="layui-input-block">
                <textarea style="padding:0px" placeholder="请输入内容" id="['{$vo.lan}']['content']" name="translations[{$vo.lan}][description]" class="layui-textarea">{$intr->translations[$key+1]->description}</textarea>
            </div>
        </div>
        {if condition="$vo.lan eq 'en'"}
        <!-- 实例化编辑器 -->
        <script type="text/javascript">
            var ue = UE.getEditor("['en']['content']");
        </script>
        {else/}
        <script type="text/javascript">
            var ue = UE.getEditor("['zh-CN']['content']");
        </script>
        {/if}
        {/if}
        {/foreach}
        {/present}

        {notpresent name="$intr->translations[1]"}
        {foreach $lang.hy as $key => $vo}

        <div class="layui-form-item">
            <label for="['{$vo.lan}']['currency']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.currency}
            </label>
            <div class="layui-input-inline">
                {foreach $lang.hy as $key => $v}
                {present name="$intr->translations[$key]->title"}
                {if condition="$vo.lan eq $intr->translations[$key]->locale"}
                <input   type="text" id="['{$vo.lan}']['currency']" name="translations[{$vo.lan}][currency]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key]->currency}">
                {else/}
                <input   type="text" id="['{$vo.lan}']['currency']" name="translations[{$vo.lan}][currency]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="">
                {/if}
                {/present}
                {/foreach}

            </div>
        </div>

        <div class="layui-form-item">
            <label for="['{$vo.lan}']['name']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.coatname}
            </label>
            <div class="layui-input-inline">
                {foreach $lang.hy as $key => $v}
                {present name="$intr->translations[$key]->title"}
                {if condition="$vo.lan eq $intr->translations[$key]->locale"}
                <input   type="text" id="['{$vo.lan}']['name']" name="translations[{$vo.lan}][name]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key]->name}">
                {else/}
                <input   type="text" id="['{$vo.lan}']['name']" name="translations[{$vo.lan}][name]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="">
                {/if}
                {/present}
                {/foreach}

            </div>
        </div>

        <div class="layui-form-item">
            <label for="['{$vo.lan}']['price']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.coatprice}
            </label>
            <div class="layui-input-inline">
                {foreach $lang.hy as $key => $v}
                {present name="$intr->translations[$key]->title"}
                {if condition="$vo.lan eq $intr->translations[$key]->locale"}
                <input   type="text" id="['{$vo.lan}']['price']" name="translations[{$vo.lan}][price]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->translations[$key]->price}">
                {else/}
                <input   type="text" id="['{$vo.lan}']['price']" name="translations[{$vo.lan}][price]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="">
                {/if}
                {/present}
                {/foreach}

            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="['{$vo.lan}']['content']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.content}
            </label>
            <div class="layui-input-block">
                {foreach $lang.hy as $key => $v}
                {present name="$intr->translations[$key]->content"}
                {if condition="$vo.lan eq $intr->translations[$key]->locale"}
                <textarea style="padding:0px" placeholder="请输入内容" id="['{$vo.lan}']['content']" name="translations[{$vo.lan}][description]" class="layui-textarea">{$intr->translations[$key]->description}</textarea>
                {else/}
                <textarea style="padding:0px" placeholder="请输入内容" id="['{$vo.lan}']['content']" name="translations[{$vo.lan}][description]" class="layui-textarea"></textarea>
                {/if}

                {/present}
                {/foreach}
            </div>
        </div>
        {if condition="$vo.lan eq 'en'"}
        <!-- 实例化编辑器 -->
        <script type="text/javascript">
            var ue = UE.getEditor("['en']['content']");
        </script>
        {else/}
        <script type="text/javascript">
            var ue = UE.getEditor("['zh-CN']['content']");
        </script>
        {/if}
        {/foreach}
        {/notpresent}

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input  readonly="readonly" type="hidden" id="uid" name="uid" required="" lay-verify="required"
                        autocomplete="off" class="layui-input nowrite" value="{$intr->uid}">
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                修改
            </button>
        </div>
    </form>
</div>


<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            var uid = $('#uid').val();
            //发异步，把数据提交给php
            $.ajax({
                dataType : 'json',
                type : 'POST',
                url : '{:url("Conferroomtype/update")}',
                async: false,
                data : $('#intr').serialize(),
                success : function(msg){
                    layer.alert(msg.msg, {icon: 6},function () {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status + "," + textStatus);
                }
            });

            return false;
        });
    });

</script>
{include file="./layout/footer.html" /}